﻿<%@ Page Title="Grupo" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Grupo.aspx.cs" Inherits="RzCorportativo.Views.Administrativo.Grupo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftContent" runat="server">
    <div class="tabbable tabs-left">
        <ul class="nav nav-tabs" id="tabMenu">
            <li class="active"><a href="#geral">Geral</a></li>
            <li><a href="#diagnostico">Permissões</a></li>
        </ul>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <script src="<%=this.ResolveUrl("~/Recursos/j/eComplete.js")%>" type="text/javascript"></script>
    <script src="<%=this.ResolveUrl("~/Recursos/j/Grupo.js")%>" type="text/javascript"></script>
    <asp:HiddenField runat="server" ID="CurriculoId" />
    <div class="tabbable tabs-left">
        <div class="tab-content">
            <div class="tab-pane active" id="geral">
                <div class="span12 well">
                    <div class="controls controls-row">
                        <asp:TextBox runat="server" ID="Descricao" placeholder="Descrição do grupo" data-toggle="tooltip"
                            title="Descrição do grupo" />
                    </div>
                    <div class="controls controls-row">
                        <asp:TextBox runat="server" ID="Login" placeholder="Login" type="text" name="complete"
                            value="" auto-complete="true" eid="login" requesttype="post" contenttype="application/json; charset=utf-8"
                            isasync="true" length="1" datatype="json" templeted="true" onrender="getItemLogin"
                            onerror="getErrorLogin" onselected="selectedItemLogin" data-toggle="tooltip"
                            title="Login" data-placement="left" />
                        <input type="button" name="btnAddUsuario" id="btnAddUsuario" value="adicionar usuário"
                            class="btn btn-success" />
                        <asp:HiddenField runat="server" ID="LoginId" />
                        <asp:HiddenField runat="server" ID="LoginText" />
                        <asp:HiddenField runat="server" ID="GrupoId" />
                    </div>
                </div>
                <div dataspy="">
                    <table class="table table-hover" id="gridGrupo" runat="server">
                        <thead>
                            <tr>
                                <th>
                                    LOGIN
                                </th>
                                <th>
                                    USUÁRIO
                                </th>
                                <th>
                                    #
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="tab-pane" id="diagnostico">
                <div dataspy="">
                    <table class="table table-hover" id="gridItens" runat="server">
                        <thead>
                            <tr>
                                <th>
                                    NOME
                                </th>
                                <th>
                                    URL
                                </th>
                                <th>
                                    TIPO
                                </th>
                                <th>
                                    #
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>
            </div>
            <div>
            </div>


            <div class="tab-pane" id="receituario">
            </div>
            <div class="tab-pane" id="atestado">
            </div>
        </div>
    </div>
    <script type="text/javascript">
        function getItemLogin(ul, item) {
            if (item.Usuario) {
                item.value = item.LoginText;
                item.label = item.LoginText;
            }
            var inner_html = '<a><div class="list_item_container"><div class=""><strong>Login:</strong> ' +
                            item.LoginText +
                            '</div><div><strong>Nome:</strong> ' + (item.Usuario ? item.Usuario.Nome == null ? "Nome não cadastrado" : item.Usuario.Nome : "Nome não cadastrado") +
                            '</div></div></a>';
            return $("<li style='width:350px'></li>")
            .data("item.autocomplete", item)
            .append(inner_html)
            .appendTo(ul);
        }

        function getErrorLogin(e) {
            var _alert = new Alert();
            _alert.Name = "erroGeral";
            _alert.Type = AlertType.Error;
            _alert.AddMessage(e.d ? e.d : e.responseText);
            _alert.Show();
        }
        function selectedItemLogin(event, ui, context) {
            var item = ui.item && ui.item.value ? ui.item : context;
            if (item.LoginId) {
                $("input[id$='LoginId']").val(item.LoginId.toString(10))
                $("input[id$='LoginText']").val(item.LoginText)
            }
        }
    </script>
</asp:Content>
